package com.wc.fortnight_blue_bridge.Q240309.E_兽之泪;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/9 19:47
 * @description https://www.lanqiao.cn/problems/16999/learning/?contest_id=174
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    static int[][] a = new int[N][2];
    static int k, n;

    public static void main(String[] args) {
        k = sc.nextInt();
        n = sc.nextInt();
        for (int i = 1; i <= k; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        // 只需要打前面怪兽
        long res1 = 0;
        int num = 0;
        PriorityQueue<Pair> q = new PriorityQueue<>();
        for (int i = 1; i < k; i++) {
            q.add(new Pair(a[i][0], i));
        }
        for (int i = 1; i <= k; i++) {
            num++;
            Pair t = q.poll();
            res1 += t.x;
            if (t.y == 0) {
                res1 += (long) (n - num) * t.x;
                break;
            }
            q.add(new Pair(a[t.y][1], 0));
            if (num == n) {
                break;
            }
        }
        if (k > n) {
            System.out.println(res1);
            return;
        }
        long res2 = 0;
        for (int i = 1; i <= k; i++) res2 += a[i][0];
        // 需要击杀k级boss
        Arrays.sort(a, 1, k + 1, Comparator.comparingInt(o -> o[1]));
        res2 += (long) (n - k) * a[1][1];
        out.println(Math.min(res1, res2));
        out.flush();
    }

    static class Pair implements Comparable<Pair> {
        int x, y;

        Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Pair o) {
            if (x == o.x) {
                return y - o.y;
            }
            return x - o.x;
        }
    }

}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}